package com.dxtan90.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

public class PropertiesReadUtils {
    //配置文件
    private static Properties properties;

    static {
        BufferedReader in = null;
        try {
            String absolutePath = new File("").getAbsolutePath();

            properties = new Properties();
            String configPath = absolutePath + "/resources/config.properties";
            in = new BufferedReader(new FileReader(configPath));
            properties.load(in);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                {
                    try {
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public static String getValue(String key){
        return properties.getProperty(key);
    }

}

